//package org.nepu.slr;
//
//
//import cn.hutool.core.bean.BeanUtil;
//import cn.hutool.core.bean.copier.CopyOptions;
//import cn.hutool.json.JSONUtil;
//import lombok.AllArgsConstructor;
//import lombok.extern.slf4j.Slf4j;
//import org.nepu.sc.reflect.GenericInitializer;
//import org.nepu.sc.task.SafeTask;
//import org.nepu.slr.井架底座绞车功能试验.C3TestParams;
//import org.nepu.slr.井架底座绞车功能试验.设备故障诊断.C32DeviceParams;
//import org.nepu.slr.井架底座绞车功能试验.运行情况检查.C31RunningParams;
//import org.nepu.slr.井架底座绞车现场检查.C2InspectParams;
//import org.nepu.slr.井架底座绞车现场检查.井架.C21WellFrameParams;
//import org.nepu.slr.井架底座绞车现场检查.底座.C23BaseParams;
//import org.nepu.slr.井架底座绞车现场检查.钻井绞车.C22CarParams;
//import org.nepu.slr.井架底座绞车结构强度.C5StrengthParams;
//import org.nepu.slr.井架底座绞车结构强度.强度校核.C51StrengthParams;
//import org.nepu.slr.井架底座绞车结构强度.检验结果分析.C52ResultParams;
//import org.nepu.slr.井架底座绞车资料.C1DataParams;
//import org.nepu.slr.井架底座绞车资料.井架底座绞车资料.C11DataParams;
//import org.nepu.slr.井架承载能力检测.C4DetectionParams;
//import org.nepu.slr.井架承载能力检测.井架承载能力检测.C41WellParams;
//import org.springframework.stereotype.Service;
//
//@Slf4j
//@Service
//@AllArgsConstructor
//public class SlrCtl {
//
//    public SafeTask updateParams(SafeTask task, String rateProcess, String jsonStr){
//
//        LongevityParams cParams = new LongevityParams().jsonBuild(task.getSrrJson());
//        // c1
//        if (rateProcess.startsWith("c1")){
//            // 提取2级参数
//            C1DataParams c1Params = GenericInitializer.getOrCreate(cParams.getC1(), C1DataParams.class);
//            // b11
//            if (rateProcess.equals("c11")) {
//                C11DataParams c11Params = GenericInitializer.getOrCreate(c1Params.getC11(),C11DataParams.class);
//                C11DataParams jsonObj = JSONUtil.toBean(jsonStr, C11DataParams.class);
//                BeanUtil.copyProperties(jsonObj,c11Params, CopyOptions.create().setIgnoreError(true).setIgnoreNullValue(true));
//                c1Params.setC11(c11Params);
//            }
//
//            cParams.setC1(c1Params);
//            task.setSrrJson(
//                    JSONUtil.toJsonStr(cParams)
//            );
//            return task;
//        }
//        //c2
//        if (rateProcess.startsWith("c2")){
//            // 提取2级参数
//            C2InspectParams c2Params = GenericInitializer.getOrCreate(cParams.getC2(), C2InspectParams.class);
//            // c21
//            if (rateProcess.equals("c21")) {
//                C21WellFrameParams c21Params = GenericInitializer.getOrCreate(c2Params.getC21(),C21WellFrameParams.class);
//                C21WellFrameParams jsonObj = JSONUtil.toBean(jsonStr, C21WellFrameParams.class);
//                BeanUtil.copyProperties(jsonObj,c21Params, CopyOptions.create().setIgnoreError(true).setIgnoreNullValue(true));
//                c2Params.setC21(c21Params);
//            }
//            if (rateProcess.equals("c22")) {
//                C22CarParams c22Params = GenericInitializer.getOrCreate(c2Params.getC22(),C22CarParams.class);
//                C22CarParams jsonObj = JSONUtil.toBean(jsonStr, C22CarParams.class);
//                BeanUtil.copyProperties(jsonObj,c22Params, CopyOptions.create().setIgnoreError(true).setIgnoreNullValue(true));
//                c2Params.setC22(c22Params);
//            }
//            if (rateProcess.equals("c23")) {
//                C23BaseParams c23Params = GenericInitializer.getOrCreate(c2Params.getC23(),C23BaseParams.class);
//                C23BaseParams jsonObj = JSONUtil.toBean(jsonStr, C23BaseParams.class);
//                BeanUtil.copyProperties(jsonObj,c23Params, CopyOptions.create().setIgnoreError(true).setIgnoreNullValue(true));
//                c2Params.setC23(c23Params);
//            }
//            cParams.setC2(c2Params);
//            task.setSrrJson(
//                    JSONUtil.toJsonStr(cParams)
//            );
//            return task;
//        }
//        //c3
//        if (rateProcess.startsWith("c3")){
//            C3TestParams c3Params = GenericInitializer.getOrCreate(cParams.getC3(), C3TestParams.class);
//            if (rateProcess.equals("c31")){
//                C31RunningParams c31Params = GenericInitializer.getOrCreate(c3Params.getC31(), C31RunningParams.class);
//                C31RunningParams jsonObj = JSONUtil.toBean(jsonStr, C31RunningParams.class);
//                BeanUtil.copyProperties(jsonObj,c31Params, CopyOptions.create().setIgnoreError(true).setIgnoreNullValue(true));
//                c3Params.setC31(c31Params);
//            }
//            if (rateProcess.equals("c32")){
//                C32DeviceParams c32Params = GenericInitializer.getOrCreate(c3Params.getC32(), C32DeviceParams.class);
//                C32DeviceParams jsonObj = JSONUtil.toBean(jsonStr, C32DeviceParams.class);
//                BeanUtil.copyProperties(jsonObj,c32Params, CopyOptions.create().setIgnoreError(true).setIgnoreNullValue(true));
//                c3Params.setC32(c32Params);
//            }
//            cParams.setC3(c3Params);
//            task.setSrrJson(
//                    JSONUtil.toJsonStr(cParams)
//            );
//            return task;
//        }
//        //c4
//        if (rateProcess.startsWith("c4")){
//            C4DetectionParams c4Params = GenericInitializer.getOrCreate(cParams.getC4(), C4DetectionParams.class);
//            if (rateProcess.equals("c41")){
//                C41WellParams c41Params = GenericInitializer.getOrCreate(c4Params.getC41(), C41WellParams.class);
//                C41WellParams jsonObj = JSONUtil.toBean(jsonStr, C41WellParams.class);
//                BeanUtil.copyProperties(jsonObj,c41Params, CopyOptions.create().setIgnoreError(true).setIgnoreNullValue(true));
//                c4Params.setC41(c41Params);
//            }
//
//            cParams.setC4(c4Params);
//            task.setSrrJson(
//                    JSONUtil.toJsonStr(cParams)
//            );
//            return task;
//        }
//        if (rateProcess.startsWith("c5")){
//            C5StrengthParams c5Params = GenericInitializer.getOrCreate(cParams.getC5(), C5StrengthParams.class);
//            if (rateProcess.equals("c51")){
//                C51StrengthParams c51Params = GenericInitializer.getOrCreate(c5Params.getC51(), C51StrengthParams.class);
//                C51StrengthParams jsonObj = JSONUtil.toBean(jsonStr, C51StrengthParams.class);
//                BeanUtil.copyProperties(jsonObj,c51Params, CopyOptions.create().setIgnoreError(true).setIgnoreNullValue(true));
//                c5Params.setC51(c51Params);
//            }
//            if (rateProcess.equals("c52")){
//                C52ResultParams c52Params = GenericInitializer.getOrCreate(c5Params.getC52(), C52ResultParams.class);
//                C52ResultParams jsonObj = JSONUtil.toBean(jsonStr, C52ResultParams.class);
//                BeanUtil.copyProperties(jsonObj,c52Params, CopyOptions.create().setIgnoreError(true).setIgnoreNullValue(true));
//                c5Params.setC52(c52Params);
//            }
//
//            cParams.setC5(c5Params);
//            task.setSrrJson(
//                    JSONUtil.toJsonStr(cParams)
//            );
//            return task;
//        }
//
//
//        return task;
//    }
//}
